package com.coflxl.admin.model;
import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;
import xyz.erupt.annotation.*;
import xyz.erupt.annotation.sub_erupt.*;
import xyz.erupt.annotation.sub_field.*;
import xyz.erupt.annotation.sub_field.sub_edit.*;
import xyz.erupt.upms.model.base.HyperModel;
import xyz.erupt.jpa.model.BaseModel;

import java.util.Set;
import java.util.Date;
@Erupt(name = "数据源配置")
@Table(name = "sys_common_db_config")
@Entity
public class USysCommonDbConfig {
    @Id
    @Column(name = "id")
    @EruptField(
            views = @View(
                    title = "系统标识"
            ),
            edit = @Edit(
                    title = "系统标识",
                    type = EditType.INPUT, notNull = true,
                    inputType = @InputType
            )
    )
    private String id;

    @EruptField(
            views = @View(
                    title = "数据源名称"
            ),
            edit = @Edit(
                    title = "数据源名称",
                    type = EditType.INPUT, search = @Search, notNull = true,
                    inputType = @InputType
            )
    )
    private String name;

    @EruptField(
            views = @View(
                    title = "数据库连接URL"
            ),
            edit = @Edit(
                    title = "数据库连接URL",
                    type = EditType.CODE_EDITOR, notNull = true,
                    codeEditType = @CodeEditorType(language = "sql")
            )
    )
    private @Lob String url;

    @EruptField(
            views = @View(
                    title = "数据库用户名"
            ),
            edit = @Edit(
                    title = "数据库用户名",
                    type = EditType.INPUT, notNull = true,
                    inputType = @InputType
            )
    )
    private String username;

    @EruptField(
            views = @View(
                    title = "数据库密码"
            ),
            edit = @Edit(
                    title = "数据库密码",
                    type = EditType.INPUT, notNull = true,
                    inputType = @InputType(type = "password")
            )
    )
    private String password;

    @EruptField(
            views = @View(
                    title = "数据库驱动类名"
            ),
            edit = @Edit(
                    title = "数据库驱动类名",
                    type = EditType.INPUT, search = @Search, notNull = true,
                    inputType = @InputType
            )
    )
    private String driver_class_name;

    @EruptField(
            views = @View(
                    title = "是否启用"
            ),
            edit = @Edit(
                    title = "是否启用",
                    type = EditType.CHOICE, notNull = true,
                    choiceType = @ChoiceType(vl = {@VL(value = "1", label = "启用"), @VL(value = "0", label = "停用")})
            )
    )
    private String enabled;

    @EruptField(
            views = @View(
                    title = "备注"
            ),
            edit = @Edit(
                    title = "备注",
                    type = EditType.TEXTAREA
            )
    )
    private String remark;

}